/**
 * Created by admin on 2018/4/14.
 */
$(document).ready(function () {
    $("form").submit(function () {
        return false;
    });
//var actFlg = "";
    var VAL = {
        NORMAL: "0000000",
        EVT_USER: $("#userId").text(),
        DISABLED_ATTR: {
            'disabled': true
        },
        ENABLED_ATTR: {
            'disabled': false
        }
    };
    var domObj = {

        buttons: {
            $print_btn: $("#print_btn"),
        },
        $companyId   :  $("#companyId"),
        $mtrlId      :  $("#mtrlId"),
        $mtrldesc    :  $("#mtrldesc"),
        $lotId       :  $("#lotId"),
        $prdQty      :  $("#prdQty"),
        $gWeight     :  $("#gWeight"),
        $nWeight     :  $("#nWeight"),
        $boxIdFk     :  $("#boxIdFk"),
        $note        :  $("#note"),
    }
    var toolFunc = {
        print_func: function () {
            var company =  $.trim(domObj.$companyId.val());
            if (!company) {
                showErrorDialog("", "公司名称不能为空");
                return false;
            }
            var mtrlId =  $.trim(domObj.$mtrlId.val());
            if (!mtrlId) {
                showErrorDialog("", "物料ID不能为空");
                return false;
            }
            var mtrldesc =  $.trim(domObj.$mtrldesc.val());
            if (!mtrldesc) {
                showErrorDialog("", "物料描述不能为空");
                return false;
            }
            var lotId =  $.trim(domObj.$lotId.val());
            if (!lotId) {
                showErrorDialog("", "批次号不能为空");
                return false;
            }
            var prdQty =  $.trim(domObj.$prdQty.val());
            if (!prdQty) {
                showErrorDialog("", "产品数量不能为空");
                return false;
            }
            var gWeight = $.trim(domObj.$gWeight.val());
            if (!gWeight) {
                showErrorDialog("", "毛重信息不能为空");
                return false;
            }
            var nWeight = $.trim(domObj.$nWeight.val());
            if (!nWeight) {
                showErrorDialog("", "净重信息不能为空");
                return false;
            }
            var boxIdFk =  $.trim(domObj.$boxIdFk.val());
            if (!boxIdFk) {
                showErrorDialog("", "箱子号不能为空");
                return false;
            }
            var note  = $.trim(domObj.$note.val());
            printBySelfunc(company,mtrlId,mtrldesc,lotId,prdQty,nWeight,gWeight,boxIdFk,note);
        }
    }

    domObj.buttons.$print_btn.bind('click', toolFunc.print_func);
    var initializationFunc = function () {

    }
    initializationFunc();

});



